package com.minelx.datamicroscope.querylanguage.data.sql;

import com.minelx.datamicroscope.querylanguage.data.CollectingField;
import com.minelx.datamicroscope.querylanguage.data.CollectingKey;
import com.minelx.datamicroscope.querylanguage.data.QueryBuilder;

import java.util.Objects;

public class SelectItem {
	private final CollectingKey collectingKey;

	private final CollectingField collectingField;

	public SelectItem(CollectingKey collectingKey, CollectingField collectingField) {
		this.collectingKey = Objects.requireNonNull(collectingKey);
		this.collectingField = Objects.requireNonNull(collectingField);
	}

	public CollectingKey getCollectingKey() {
		return collectingKey;
	}

	public CollectingField getCollectingField() {
		return collectingField;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		SelectItem that = (SelectItem) o;
		return collectingKey.equals(that.collectingKey) && collectingField.equals(that.collectingField);
	}

	@Override
	public int hashCode() {
		return Objects.hash(collectingKey, collectingField);
	}

	@Override
	public String toString() {
		return "SelectItem{" +
				"collectingKey=" + collectingKey +
				", collectingField=" + collectingField +
				'}';
	}
}
